<template>
	<div style="width=200px">
		<el-form ref="form" :rules="rules" :model="form" label-width="120px">
			<el-form-item label="客户姓名" prop="customerName">
				<el-input v-model="form.customerName"></el-input>
			</el-form-item>
			<el-form-item label="护理项目" prop="nursingClassification">
				<el-input v-model="form.nursingClassification"></el-input>
			</el-form-item>
			<el-form-item label="护理时间" >
				
				<el-date-picker
				      v-model="form.recordsTime"
				      type="datetime"
					  format="yyyy-MM-dd HH:mm:ss"
					  value-format="yyyy-MM-dd HH:mm:ss"
				      placeholder="选择日期">
				    </el-date-picker>
			
			</el-form-item>
			<el-form-item label="数量" prop="recordsNumber">
				<el-input v-model="form.recordsNumber"></el-input>
			</el-form-item>
			<el-form-item label="护理内容" prop="nursingContent">
				<el-input v-model="form.nursingContent"></el-input>
			</el-form-item>
			<el-form-item label="护理人员" prop="recordsAmount">
				<el-input v-model="form.recordsAmount"></el-input>
			</el-form-item>

			<el-form-item>
				<el-button type="primary" plain @click="save">保存数据</el-button>

			</el-form-item>
		</el-form>
		
	</div>
</template>

<script>
	export default {
		name: 'NursingRecordsEdit',
		components: {

		},
		props: [
			'show',
			'editid'
		],
		data() {
			return {
				form: {
					recordsId: '',
					customerName: '',
					nursingClassification: '',
					recordsTime: '',
					recordsNumber: '',
					nursingContent: '',
					recordsAmount: ''
				},
				rules: {

					customerName: [{
							required: true,
							message: '类别名不能为空',
							trigger: 'blur'
						},
						{
							min: 1,
							max: 100,
							message: '长度在 1 到 100 个字符',
							trigger: 'blur'
						}
					]
				},

				nursing_records: [],
				depts: [],
			}
		},
		
		created() {
			if (this.editid) {
				this.show = true;
				this.$axios.get(
					'/nursingRecords/getById',
					response => {
						this.form = response.obj
						
					}, 
					{id: this.editid })
			}
		},
		methods: {
			save() {
				this.axios.get('/nursingRecords/add', (data) => {
					if (data) {
						this.$emit('update:show', false)
						this.$emit('getData')
					}

				}, this.form, '保存成功');
			},
			update(){
				this.axios.get('/nursingRecords/update', (data) => {
					if (data) {
						this.$emit('update:show', false)
						this.$emit('getData')
					}
				
				}, this.id,this.status,'更新成功');
				
			}
			
		}

	}
</script>

<style>
</style>
